/*
 * Copyright 2008. Mount Sinai Hospital, Toronto, Canada.
 * 
 * Licensed under the Apache License, Version 2.0. You
 * can find a copy of the license at:
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * IN NO EVENT SHALL MOUNT SINAI HOSPITAL BE LIABLE TO ANY PARTY FOR DIRECT, 
 * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST 
 * PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, 
 * EVEN IF MOUNT SINAI HOSPITAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
 * DAMAGE.
 * 
 * MOUNT SINAI HOSPITAL SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF 
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND 
 * ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". 
 * MOUNT SINAI HOSPITAL HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, 
 * UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
 */

package com.sinai.mshab.data.core;

import com.google.gwt.user.client.ui.CheckBox;



/**
 * A Data Structure for storing the {@code isChecked} Value and label text 
 * associated with a particular {@link CheckBox} object. 
 * 
 * @author Jason Kong
 *
 */

//public class CheckBoxValueLabelPair implements Comparable<CheckBoxValueLabelPair>{
public class CheckBoxValueLabelPair {
	
	private boolean isChecked;
	private String label;
	
	
	/**
	 * Creates a {@code CheckBoxValueLabel} using the specified 
	 * {@code isChecked} value and with a label specified by {@code label}
	 * @param isChecked
	 * @param label
	 */
	public CheckBoxValueLabelPair(boolean isChecked, String label) {
		this.isChecked = isChecked;
		this.label = label;
	}	
	

	/**
	 * 
	 * @return
	 */
	public boolean isChecked() {
		return isChecked;
	}


	/**
	 * 
	 * @param isChecked
	 */
	public void setChecked(boolean isChecked) {
		this.isChecked = isChecked;
	}


	/**
	 * 
	 * @return
	 */
	public String getLabel() {
		return label;
	}


	/**
	 * 
	 * @param label
	 */
	public void setLabel(String label) {
		this.label = label;
	}


	@Override
	public String toString() {
		return CheckBoxValueLabelPair.class.getName() + ":" + this.isChecked 
			+ "," + this.label;
	}

	
	/*public int compareTo(CheckBoxValueLabelPair compareToObj) {
		int checkValuesCompare = (this.isChecked && compareToObj.isChecked()) ? 0 : 1; 
		
		return this.label.compareTo(compareToObj.getLabel()) 
		 + checkValuesCompare;
		
		
		
	}
	*/
	public boolean equals(Object equalToObj) {
		if (!(equalToObj instanceof CheckBoxValueLabelPair)) {
			return false;
		}else {
			CheckBoxValueLabelPair equalToCheckBoxValueLabelPair = 
				(CheckBoxValueLabelPair) equalToObj; 
			
			if((this.isChecked == equalToCheckBoxValueLabelPair.isChecked())
					&& (this.getLabel().equals
							(equalToCheckBoxValueLabelPair.getLabel())))
				return true;
			else
				return false;
			}
	}
	



	

}
